﻿using Nantianmen.Domain.Models;
using Nantianmen.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Nantianmen.Core.Stores
{
    public abstract class RouteStoreBase : StoreBase, IRouteStore, IQueryableRouteStore
    {
        public NantianmenErrorDescriber ErrorDescriber { get; set; }

        public RouteStoreBase(NantianmenErrorDescriber errorDescriber)
        {
            ArgumentNullException.ThrowIfNull(errorDescriber);
            ErrorDescriber = errorDescriber;
        }
        public abstract IQueryable<Route> Routes { get; }
        public abstract Task<bool> CheckDuplicateRouteIdAsync(string routeId, CancellationToken cancellationToken);
        public abstract Task<NantianmenResult> CreateAsync(Route route, CancellationToken cancellationToken);
        public abstract Task<List<Route>> ListRoutesAsync(CancellationToken cancellationToken);
        public abstract Task<NantianmenResult> UpdateAsync(Route route, CancellationToken cancellationToken);

        public abstract Task<Route?> FindByIdAsync(string routeId, CancellationToken cancellationToken);
        public abstract Task<NantianmenResult> RemoveAsync(Route route, CancellationToken cancellationToken); 
    }
}
